home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / ConditionalMacros.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  6.2 KB  |  182 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        ConditionalMacros.a
  3. ;
  4. ;    Contains:    Compile time feature switches to achieve platform independent sources.
  5. ;
  6. ;    Version:    Technology:    Universal Interface Files 2.1
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
  21. __CONDITIONALMACROS__ SET 1
  22.  
  23. ;
  24. ;    This file sets up the following compiler independent conditionals:
  25. ;    
  26. ;    GENERATINGPOWERPC        - Compiler is generating PowerPC instructions
  27. ;    GENERATING68K            - Compiler is generating 68k family instructions
  28. ;    GENERATING68881            - Compiler is generating mc68881 floating point instructions
  29. ;    GENERATINGCFM            - Code being generated assumes CFM calling conventions
  30. ;    CFMSYSTEMCALLS            - No A-traps.  Systems calls are made using CFM and UPP's
  31. ;    
  32. ;    SystemSevenFiveOrLater    - Compiled code will only be run on a System 7.5 or later Macintosh
  33. ;    SystemSevenOrLater        - Compiled code will only be run on a System 7.0 or later Macintosh
  34. ;    SystemSixOrLater        - Compiled code will only be run on a System 6.0 or later Macintosh
  35. ;                              A developer should set the appropriate flag on the compiler command-
  36. ;                              line or in a file processed before this file.  This will allow the
  37. ;                              certain optimizations to be made which can result in smaller, faster
  38. ;                              applications.
  39. ;    
  40. ;    CGLUESUPPORTED            - Interface library will support "C glue" functions (function names
  41. ;                              are: all lowercase, use C strings instead of pascal strings, use 
  42. ;                              Point* instead of Point).
  43. ;
  44. ;    OLDROUTINENAMES            - "Old" names for Macintosh system calls are allowed in source code.
  45. ;                              (e.g. DisposPtr instead of DisposePtr). The names of system routine
  46. ;                              are now more sensitive to change because CFM binds by name.  In the 
  47. ;                              past, system routine names were compiled out to just an A-Trap.  
  48. ;                              Macros have been added that each map an old name to its new name.  
  49. ;                              This allows old routine names to be used in existing source files,
  50. ;                              but the macros only work if OLDROUTINENAMES is true.  This support
  51. ;                              will be removed in the near future.  Thus, all source code should 
  52. ;                              be changed to use the new names! You can set OLDROUTINENAMES to false
  53. ;                              to see if your code has any old names left in it.
  54. ;    
  55. ;    OLDROUTINELOCATIONS     - "Old" location of Macintosh system calls are used.  For example, c2pstr 
  56. ;                              has been moved from Strings to TextUtils.  It is conditionalized in
  57. ;                              Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
  58. ;                              This allows developers to upgrade to newer interface files without suddenly
  59. ;                              all their code not compiling becuase of "incorrect" includes.  But, it
  60. ;                              allows the slow migration of system calls to more understandable file
  61. ;                              locations.  OLDROUTINELOCATIONS currently defaults to true, but eventually
  62. ;                              will default to false.
  63. ;    
  64. ;    PRAGMA_ALIGN_SUPPORTED    - Compiler supports "#pragma align=..." directives. The only compilers that
  65. ;                              can get by without supporting the pragma are old classic 68K compilers
  66. ;                              that will only be used to compile older structs that have 68K alignment
  67. ;                              anyways.  
  68. ;    
  69. ;    PRAGMA_IMPORT_SUPPORTED    - Compiler supports "#pragma import on/off" directives.  These directives
  70. ;                              were introduced with the SC compiler which supports CFM 68K.  The directive
  71. ;                              is used to tell the compiler which functions will be called through a 
  72. ;                              transition vector (instead of a simple PC-relative offset).  This allows 
  73. ;                              the compiler to generate better code.  Since System Software functions are
  74. ;                              implemented as shared libraries and called through transition vectors,
  75. ;                              all System Software functions are declared with "#pragma import on".
  76. ;                              
  77. ;    
  78. ;    There are some invariants among the conditionals:
  79. ;    
  80. ;    GENERATINGPOWERPC != GENERATING68K
  81. ;    GENERATING68881 => GENERATING68K
  82. ;    GENERATINGPOWERPC => GENERATINGCFM
  83. ;    GENERATINGPOWERPC => CFMSYSTEMCALLS
  84. ;    CFMSYSTEMCALLS => GENERATINGCFM
  85. ;    GENERATINGPOWERPC => SystemSevenOrLater
  86. ;    SystemSevenFiveOrLater => SystemSevenOrLater
  87. ;    SystemSevenOrLater => SystemSixOrLater
  88. ;    PRAGMA_IMPORT_SUPPORTED => CFMSYSTEMCALLS
  89. ;    
  90. ;
  91. ;
  92. ;
  93. ;    Set up UNIVERSAL_INTERFACES_VERSION
  94. ;    
  95. ;        0x210 => version 2.1
  96. ;        This conditional did not exist prior to version 2.1
  97. ;
  98. UNIVERSAL_INTERFACES_VERSION EQU $0210
  99. ;
  100. ;
  101. ;    Set up GENERATINGPOWERPC and GENERATING68K
  102. ;
  103. ;
  104.     IF &TYPE('PowerAsm') <> 'UNDEFINED' THEN
  105.     GENERATINGPOWERPC: SET 1
  106.     GENERATING68K: SET 0
  107.     ELSE
  108.     GENERATINGPOWERPC: SET 0
  109.     GENERATING68K: SET 1
  110.     ENDIF
  111. ;
  112. ;
  113. ;    Set up GENERATING68881 
  114. ;
  115. ;
  116.     IF &TYPE('GENERATING68881') = 'UNDEFINED' THEN
  117.     GENERATING68881: SET 0
  118.     ENDIF
  119. ;
  120. ;
  121. ;    Set up GENERATINGCFM and  CFMSYSTEMCALLS
  122. ;
  123. ;
  124.     GENERATINGCFM:  SET GENERATINGPOWERPC
  125.     CFMSYSTEMCALLS:  SET GENERATINGPOWERPC
  126.     IF GENERATING68K THEN
  127.         IF &TYPE('&SYSMODEL') <> 'UNDEFINED' THEN
  128.             IF &SYSMODEL = '__CFM68K__' THEN
  129.                 GENERATINGCFM: SET 1
  130.                 CFMSYSTEMCALLS: SET 1
  131.             ENDIF
  132.         ENDIF
  133.     ENDIF
  134. ;
  135. ;
  136. ;    Set up SystemSevenFiveOrLater, SystemSevenOrLater, and SystemSixOrLater
  137. ;
  138. ;
  139.     IF &TYPE('SystemSevenFiveOrLater') = 'UNDEFINED' THEN
  140.     SystemSevenFiveOrLater: SET 0
  141.     ENDIF
  142.     IF &TYPE('SystemSevenOrLater') = 'UNDEFINED' THEN
  143.     IF GENERATINGCFM  THEN
  144.     SystemSevenOrLater: SET 1
  145.     ELSE
  146.     SystemSevenOrLater: SET SystemSevenFiveOrLater
  147.     ENDIF
  148.     ENDIF
  149.     IF &TYPE('SystemSixOrLater') = 'UNDEFINED' THEN
  150.     SystemSixOrLater: SET SystemSevenOrLater
  151.     ENDIF
  152. ;
  153. ;
  154. ;    Set up OLDROUTINENAMES and OLDROUTINELOCATIONS
  155. ;
  156. ;
  157.     IF &TYPE('OLDROUTINENAMES') = 'UNDEFINED' THEN
  158.     OLDROUTINENAMES: SET 1
  159.     ENDIF
  160.     IF &TYPE('OLDROUTINELOCATIONS') = 'UNDEFINED' THEN
  161.     OLDROUTINELOCATIONS: SET 1
  162.     ENDIF
  163. ;
  164. ;
  165. ;    Define IMPORT_CFM_FUNCTION macro
  166. ;
  167. ;
  168.     IF GENERATINGCFM  THEN
  169.     IF GENERATINGPOWERPC  THEN
  170.         Macro
  171.         IMPORT_CFM_FUNCTION        &functionName
  172.         IMPORT                    .&functionName
  173.         EndM
  174.     ELSE
  175.         Macro
  176.         IMPORT_CFM_FUNCTION        &functionName
  177.         IMPORT                    &functionName
  178.         EndM
  179.     ENDIF
  180.     ENDIF
  181.     ENDIF ; __CONDITIONALMACROS__
  182.